/*----------------------------------------------------------------------------*/
/* Team 3647
/* Tower.java
/*
/* Ball Lift controls
/* Ball Stop
/*----------------------------------------------------------------------------*/
package Robot;

import edu.wpi.first.wpilibj.Solenoid;

public class Tower {

    private static final Solenoid bridgeUp    = new Solenoid(4);
    private static final Solenoid bridgeDown  = new Solenoid(3);
    
    private static final Solenoid stopIn   = new Solenoid(5);
    private static final Solenoid stopOut  = new Solenoid(6);
    public static final LinearVictor towerLift = new LinearVictor(8);
    
    public static void BallLift() {
        double speed = 1;
        if (DriveTrain.GamePad.getRawButton(6)) {
            towerLift.set(speed);
        } else if (DriveTrain.GamePad.getRawButton(5)) {
            towerLift.set(-speed);
        } else {
            towerLift.set(0);
        }
    }

    public static void Stop() {
        if(DriveTrain.OpStick.getRawButton(4)) 
            StopOut();
        else if(DriveTrain.OpStick.getRawButton(5))
            StopIn(); 
    }
    
    private static boolean stopped = false, value = false;
    public static void Birdge() {
        boolean stopButton = DriveTrain.GamePad.getRawButton(2);
        if (stopButton && !stopped) {
            value = !value;
            if (value) {
                BridgeDown();
            } else {
                BridgeUp();
            }
            stopped = true;
        } else if (!stopButton) {
            stopped = false;
        }
    }
    
    public static void StopOut() {
        stopIn.set(true);
        stopOut.set(false);
    }

    public static void StopIn() {
        stopIn.set(false);
        stopOut.set(true);
    }    
    
    public static void BridgeDown() {
        bridgeDown.set(true);
        bridgeUp.set(false);
    }

    public static void BridgeUp() {
        bridgeDown.set(false);
        bridgeUp.set(true);
    }
  
}
